What is the Probability?
T=input()
for t in range(int(T)):
m,p,k=map(float,input().split())
q=1-p
if (1-q**m)==0:
print('0.0000')
else:
ans=(q**(k-1)*p)/(1-q**m)
print('{:.4f}'.format(ans))
The Hotel with Infinite Rooms
while 1:
try:
g,d=map(int,input().split())
f=2*d+g**2-g
ans=int(f**(1/2))
if ans*(ans+1)<f:
ans+=1
print(ans)
except:
break